#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main()
{
	int n; cin >> n;
	map<int, int> hash;
	for (int i = 0; i < n; ++i) { int tmp; cin >> tmp; hash[tmp]++; }
	vector<int> arr;
	for (auto e : hash) arr.push_back(e.second);
	sort(arr.begin(), arr.end(), greater<int>());
	int l = n / 2, ans = 0;
	while (l > 0) l -= arr[ans++];
	cout << ans;
	return 0;
}